package com.twu.biblioteca;

public class Book extends LibraryItem {

    private final String author;

    public Book(String title, String author, String yearPublished) {
        super(title, yearPublished);
        this.author = author;
    }

    public String getAuthor() {
        return author;
    }

    @Override
    public String toString() {
        return "Title: '" + this.getTitle() + "'" + Book.LIST_SEPARATOR +
                "Author: '" + this.author + "'" + Book.LIST_SEPARATOR +
                "Published: '" + this.getYearPublished() + "'";
    }

    public boolean compareWithDetails(String title, String author, String year) {
        return (this.getTitle().equalsIgnoreCase(title) &&
                this.getAuthor().equalsIgnoreCase(author) &&
                this.getYearPublished().equalsIgnoreCase(year));
    }
}
